package com.github.gaojh.server.http;


import com.github.gaojh.server.multipart.FileItem;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpMethod;
import java.util.Map;

public interface HttpRequest {

    String getHost();

    String getUri();

    String getUrl();

    Map<String, String> getParameters();

    Map<String, String> getHeaders();

    String getHeader(String name);

    Map<String, FileItem> getFileItems();

    String getBody();

    boolean isKeepAlive();

    ChannelHandlerContext getCtx();

    HttpMethod getMethod();

    FullHttpRequest getFullHttpRequest();

    default boolean isFormRequest() {
        return this.getHeader("Content-Type") != null && this.getHeader("Content-Type").toLowerCase().contains("form");
    }
}
